<%@ page language="java" import="java.util.*,com.icss.ah.base.util.ResourceLoader" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String proDesc = ResourceLoader.getInstance("icss").getString("proDesc");
%>

<!DOCTYPE HTML>
<html>
  <head>
  	<meta http-equiv="X-UA-Compatible" content="IE=8">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta content="B2B电商平台" name="description"/>
	<meta content="B2B电商平台" name="keyword"/>
	
	<title>B2B电商平台.店铺商品类型维护</title>
	<link rel="icon" href="include/images/icss.ico" type="image/x-icon" />
	<link rel="shortcut icon" href="include/images/icss.ico" type="image/x-icon" />
	<link rel="stylesheet" href="<%=path%>/include/JQuery zTree v3.4/css/demo.css">
	<link rel="stylesheet" href="<%=path%>/include/JQuery zTree v3.4/css/zTreeStyle/zTreeStyle.css">
	<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/global.css" />
	<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/style.css" />
	<link rel="stylesheet" href="<%=path%>/include/uploadify/uploadify.css" type="text/css"></link>
	
	<script type="text/javascript" src="<%=path %>/include/js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="<%=path %>/include/js/icss.shop.manage.js"></script>
	<script type="text/javascript" src="<%=path %>/include/js/cookies.js"></script>
    <script type="text/javascript" src="<%=path%>/include/JQuery zTree v3.4/js/jquery.ztree.core-3.4.js"></script>
	<script type="text/javascript" src="<%=path%>/include/JQuery zTree v3.4/js/jquery.ztree.excheck-3.4.js"></script>
	<script type="text/javascript" src="<%=path %>/include/js/icss.busin.js"></script>
	<script type="text/javascript" src="<%=path %>/include/js/icss.common.js"></script>
	<script type="text/javascript" src="<%=path%>/include/uploadify/jquery.uploadify-3.1.min.js"></script>
	<script type="text/javascript" src="<%=path%>/include/uploadify/swfobject.js"></script>
	
	<script type="text/javascript" charset="utf-8" src="<%=path%>/include/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="<%=path%>/include/ueditor/ueditor.all.min.js"> </script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="<%=path%>/include/ueditor/lang/zh-cn/zh-cn.js"></script>
	
	<style type="text/css">
		body{font-size: 14px;padding: 0px;}
		.title_div{
			height: 81px;
			padding-top: 20px;
			text-align: center;
			//border-bottom: 3px solid #e0e0e0;
			background: #fff;
		}
		.titleCss{
			height: 65px;
			width: 790px;
			margin: 0 auto;
			background: url('<%=path %>/images/postTrade/post_trade_one.png') no-repeat 0 0;
		}
		.title_2{
			background-position: 0 -200px;
		}
		.mainDiv{
			margin: 10px auto;
		}
		.nextDiv button{
		    font: 20px "Microsoft YaHei", "SimHei ";
	    	line-height: 63px;
    		width: 203px;
			background: url('<%=path %>/images/postTrade/pic-global.png') no-repeat -148px -558px;
			color: #fff;
		}
	    .subDiv{
	    	height: 103px;
	    	text-align: center;
	    	padding-top: 60px;
	    	background: #fff;
	    }
	    .nextDiv{
	    	width: 279px;
	    	height: 100%;
	    	margin: 0px auto;
	    }
	    .main_div1{
	    	background:#fff; 
	    	height:48px;
	    	margin: 10px 0px;
	    	border-top: 4px solid #F75D5F;
	    	line-height: 48px;
	    	padding: 0px 10px;
	    }
	    .btCss{
	    	height: 22px;
    		width: 60px;
    		background: url('<%=path %>/images/postTrade/abtnBg.png');
    		float: left;
    		margin: 13px 0 0 20px;
    		font-size: 12px;    
    		line-height: 22px;
    		padding-left: 20px;
    		margin-left: 20px;
	    }
	    a {
		    color: #039;
		    text-decoration: none
	    }
	    ul,li{
	    	list-style: none;
	    }
	    .main_div1 li{
	    	float: left;
	    	font-size: 12px;
	    }
	    .saveDraftCss{
	    	float: right;
	    	border: 1px solid #cfcfcf;
	    	color:#333;
	    	line-height:28px;
	    	margin:10px 0px;
	    	padding: 0px 20px;
	    }
	    .saveDraftCss:hover {
	    	background: #ff8048;
	    	color:#fff;
	    	border: 1px solid #f67943;
	    }
	    .getDraftCss:hover {
	    	color:red;
	    }
	    .divCss_title{
	    	background: #fff;
		    height: 40px;
		    font: 18px/40px "Microsoft YaHei", "SimHei ";
		    text-indent: 10px;
		    border-bottom: 1px solid #d1d1d1;
		    color: #000;
		   
	    }
	    .tipH4{
	    	width:80px;
	    	float:left;
	    	font-weight: bold;
	    	line-height: 18px;
	    }
	    .cdyParaCss ul{
	    	width: 280px;border: 1px solid #c7c7c7;height: 22px;
	    }
	    .cdyParaCss ul li{
	    	display:none;
	    }
	    .cdyParaCss .tdL{
	    	text-align: right;width: 152px;
	    }
	    .cdyParaCss .tdR{
	    	text-align: left;padding-left: 10px;vertical-align: middle;
	    }
	    .cdyParaCss .tdR div{
	    	width:280px;border: 1px solid #c7c7c7;height: 22px;
	    }
	    .cdyParaCss .tdR input{
	    	border: 0px;padding: 0px 3px;margin-top: -15px;width: 250px;
	    }
	    .cdyParaCss .tdR s,td div s,.addPrice_css{
    	    float: right;
		    width: 21px;
		    height: 22px;
		    background: url('<%=path %>/images/postTrade/pic-global.png') no-repeat -275px -275px;
	    }
	    .cdyParaCss .tdR select{
	    	appearance:none;-moz-appearance:none;-webkit-appearance:none;
	    	width: 282px;margin: 20px 0 0 -257px;position: absolute;overflow: auto;max-height: 200px;
	    }
	    .cdyParaCss .tdR select option{
	    	heigth:20px;padding:5px 3px 0px;
	    }
	    .cdyParaCss .tdR select option:hover{
	    	background: #ebebeb;
	    }
	    .borderCss{
	    	border-top: 1px dashed #ccc;margin: 20px 80px;padding-bottom: 5px;
	    }
	    .div_title_css{
	    	border: 0px;margin: 15px 0px 10px 80px;;white-space: nowrap;
	    }
	    .div_title_css table tr td{
	    	width: 16%;
	    }
	    .div_title_css table tr td input{
	    	width: 90%;height: 22px;
	    }
	    .div_title_css p{
	    	color: #999;padding: 10px 0px 10px 83px;white-space: normal;
	    }
	    .radioCss{
	    	margin: 0px;
	    }
	    .line_color_css td{
	    	border-top: 1px solid #c7c7c7;
	    }
	    .td1{
	    	width: 130px;text-align: right;padding-right: 10px;
	    }
	    .addPrice_css{
	    	height: 11px;
		    background-position: -478px -298px;
		    margin-top: 11px;
		    margin-left: 5px;
		    float: left;
	    }
	    .img_css{
	    	padding-right: 10%;float: left;width: 14%;margin-top: 20px;
	    }
	    .add_img_div{
	     	height: 102px;
    		width: 102px;
	    	background: url('<%=path %>/images/postTrade/addIco.png') no-repeat 0px -50px;
	    }
	    td {
	    	vertical-align: middle;
	    }
	</style>
	
	<script type="text/javascript">
	   $(document).mousedown(function (e) {  
         	var className = $(e.target).attr("class");
         	if(className!='selectI'&&className!='selectS'&&className!='selectO'&&className!='selType'){
         		$(".checkSelect").hide();
         		_clickInput('1');
         	}
     	}); 

		function _goBackPage(){//返回上一页
			window.location.href = "<%=path %>/postTrade/toPostTradeOnePage.do";
		}
		function _getDraftListPage(){//草稿列表页
			window.location.href = "<%=path %>/postTrade/toPostTradeOnePage.do";
		}
		function _saveDraftInfo(){//草稿列表页
			window.location.href = "<%=path %>/postTrade/toPostTradeOnePage.do";
		}
		function _selVal(para){//商品参数项搜索
			$("#sel0").css("display","");
			$("#sel0").size(6);
			$(".att0").css("border","1px solid #86b4f8");
			$(".att0 s").css("background-position", "-275px -308px");
		}
		var paraNum = 0;
		function _baseParam(code){
			$.ajax({
				type:"post",
				url:'<%=path%>/postTrade/queryBaseParam.do',
				dataType:"json",
				data:{itemCode:code},
				success:function(data){
					if(data){
						var arr = data.baseParaList;
						var colNames = "0";
						var paraNames = "0";
						var paramShows = "0";
						paraNum = arr.length;
						for(var i=0;i<arr.length;i++){
							var d = arr[i];
							colNames += ",att"+i;
							paraNames += ","+d.PARAM_NAME;
							paramShows += ","+d.PARAM_SHOW;
							var html = "<tr>";
							html += "	<td class='tdL'>"+d.PARAM_NAME+"：</td>";
							html += "	<td class='tdR'>";
							html += "		<div class='att"+i+"'>";
							if(d.PARAM_TYPE==2){ 
								html += "<input id='att"+i+"' onclick=\"_clickInput('att"+i+"')\" class='selectI' onchange='_changeVal(this.id)' name='att"+i+"' placeholder='可直接输入内容'/>";
								html += "<s onclick=\"_clickInput('att"+i+"')\" class='selectS'> </s><br/>";
							}else{
								html += "<input id='att"+i+"' name='att"+i+"' placeholder=''/>";
							}
							html += "		</div>";
							html += "<input type=\"hidden\" id=\"viewCode"+i+"\" name=\"viewCode"+i+"\" value=\""+d.PARAM_ENTRANCE+"\">";
							html += "<input type=\"hidden\" id=\"pUuid"+i+"\" name=\"pUuid"+i+"\" value=\""+d.pUuid+"\">";
							html += "	</td>";
							html += "</tr>";
							$("#cdyPara").append(html);
						}
						$("#colNames").val(colNames);
						$("#paraNames").val(paraNames);
						$("#paramShows").val(paramShows);
						for(var i=0;i<arr.length;i++){
							var d = arr[i];
							if(d.PARAM_TYPE==2) _pullList(i,d.PARAM_ENTRANCE);
						}
						_reHeight("rightFrame","contentDiv");
					}
				}
			});
		}

		function _pullList(num,viewCode){//select下拉列表
			var codeName = $("#codeName").val();
			$.ajax({
				type:"post",
				url:'<%=path%>/postTrade/queryDirectoryInfo.do',
				dataType:"json",
				//async:true,
				data:{viewCode:viewCode,codeName,codeName,flag:"1"},
				success:function(data){
					if(data){
						//$("#sel"+num).remove();
						var arr = data.directoryList;
						var html = "";
						if(arr.length==1)
							html += "<select id='sel"+num+"' size='"+arr.length+"' class='att"+(num+1)+" checkSelect' style='display:none;overflow: hidden;margin-top: 22px;'>";
						else
							html += "<select id='sel"+num+"' size='"+arr.length+"' class='att"+num+" checkSelect' style='display:none;margin-top: 22px;'>";
						for(var i=0;i<arr.length;i++){
							var d = arr[i];
							html += "<option onclick=\"_clickOption('att"+num+"','"+d.CODE_NAME+"')\" class='selectO' value='"+d.CODE_NAME+"'>"+d.CODE_NAME+"</option>";
						}
						html += "</select>";
						$("#att"+num).after(html);
					}
				}
			});
		}

		var para = "0";
		function _addPara(){
			var colNames = $("#colNames").val()+",att"+paraNum;
			para += ","+paraNum;
			var html = "<tr id='pn"+paraNum+"'>";
			html += "	<td class='tdL'><input id='para"+paraNum+"' name='para"+paraNum+"' style='text-align: right;height: 18px;width: 120px;' placeholder=''/>：</td>";
			html += "	<td class='tdR'>";
			html += "		<div class='att"+paraNum+"' style='float: left;margin-top: 5px;'>";
			html += "			<input id='att"+paraNum+"' name='att"+paraNum+"' placeholder=''/>";
			html += "		</div>";
			html += "		<input type=\"hidden\" id=\"pUuid"+paraNum+"\" name=\"pUuid"+paraNum+"\" value=\"-1\">";
			html += "		<span onclick=\"_delParaTr('"+paraNum+"')\" style='padding-left:5px;color:#039;margin-left:10px;'>删除</span>";
			html += "	</td>";
			html += "</tr>";
			paraNum++;
			$("#cdyPara").append(html);
			$("#colNames").val(colNames);
		}

		function _delParaTr(id){
			$("#pn"+id).remove();
			var colNames = $("#colNames").val();
			colNames = colNames.replace(",att"+id,'');
			$("#colNames").val(colNames);
		}

		function _addParaName(){
			var paraNames = $("#paraNames").val();
			var arr = para.split(",");
			for(var i=1;i<arr.length;i++){
				var val = $("#para"+arr[i]).val();
				if(typeof(val)=="undefined" || val==""){
					 _delParaTr(arr[i]);
				}else{
					 paraNames += ","+val;
				}
			}
			$("#paraNames").val(paraNames);
		}

		function _changeVal(id){
			$("#codeName").val($("#"+id).val());
			id = id.replace("att","");
			var viewCode = $("#viewCode"+id).val();
			//_pullList(id,viewCode);
			//_clickInput("att"+id);
		}
		
		function _clickInput(id){
			$("select[class!=selType]").css("display","none");
			$("select").parent("div").css("border","1px solid #c7c7c7");
			$("select").next("s").css("background-position", "-275px -275px");
			$("."+id).css("display","");
			$("."+id).css("border","1px solid #86b4f8");
			$("."+id+" s").css("background-position", "-275px -308px");
		}

		function _clickOption(id,val){
			$("#"+id).val(val);
			$("."+id).css("border","1px solid #c7c7c7");
			$("."+id+" s").css("background-position", "-275px -275px");
			id = id.replace("att","");
			$("#sel"+id).css("display","none");
			if(id=="measuring"){
				 $(".unitVal").empty();
				 $(".unitVal").text(val);
			}
		}

		function _measuringInfo(){//计量单位 flag: 2
			$.ajax({
				type:"post",
				url:'<%=path%>/postTrade/queryDirectoryInfo.do',
				dataType:"json",
				data:{flag:"2"},
				success:function(data){
					if(data){
						var arr = data.directoryList;
						var html = "<br><select id='selmeasuring' size='"+arr.length+"' class='measuring' style='display:none;overflow: hidden;margin:-18px 0px 0px -1px;position: absolute;width:173px;'>";
						//if(arr.length==1)
						//else
						//	html += "<select id='selmeasuring' size='"+arr.length+"' class='measuring' style='margin:22px 0px 0px -150px;position: absolute;width:172px;'>";
						for(var i=0;i<arr.length;i++){
							var d = arr[i];
							html += "<option onclick=\"_clickOption('measuring','"+d.CODE_NAME+"')\" class='selectO' value='"+d.CODE_NAME+"'>"+d.CODE_NAME+"</option>";
						}
						html += "</select>";
						$(".measuring").append(html);
						_reHeight("rightFrame","contentDiv");
					}
				}
			});
		}
		
		function _save(){
    		_addParaName();
    		var brandCode = $("#selbrand").val();
       		var brand = $("#brand").val();
    		if(brand == null || brand == ''){
    			alert("请选择品牌名称");
    			return;
    		}
    		var postName = $("#postName").val();
    		if(_checkKeyWord()){
        		alert("请维护商品关键字");
    			return;
    		}
    		var measuring = $("#measuring").val();
    		if(measuring==null||measuring==""){
    			alert("请选择商品计量单位");
        		return;
    		}
    		_vfnPrice();
    		if(vPrice==1){
        		alert("价格区间不完善");
        		return;
    		}
    		var proStock = $("#proStock").val();
    		if(proStock==null||proStock==""){
    			alert("请维护供应量");
        		return;
    		}
    		var proPrice = $("#proPrice").val();
    		if(proPrice==null||proPrice==""){
    			alert("请维护供应价格");
        		return;
    		}
        	var descHtml = ue.getContent();
    		if(descHtml==null||descHtml==""){
    			alert("请维护商品描述");
        		return;
    		}
        	$("#postDesc").val(descHtml);
    		var dataStr = {};
 		    var dataArr = $("input").serializeArray();
 		    for (var i = 0; i < dataArr.length; i++) {
 		        dataStr[dataArr[i].name] = dataArr[i].value;
 		    }
 		    var colNames = $("#colNames").val();
 		    dataStr["brandCode"]=brandCode;
 		    dataStr["colNames"]=colNames;
 		    var paraNames = $("#paraNames").val();
 		    dataStr["paraNames"]=paraNames;
 		    var paramShows = $("#paramShows").val();
 		    dataStr["paramShows"]=paramShows;
 		    var imgNum = $("#imgNum").val();
 		    if(imgNum==null||imgNum==""){
 		    	alert("请至少维护一张商品图片");
        		return;
 		    }
 		    dataStr["imgNum"]=imgNum;
			var arrCol = colNames.split(",");
			var arrPara = paraNames.split(",");
			for(var i=1;i<arrCol.length;i++){
				var val1 = $("#"+arrCol[i]).val();
				if(null==val1 || val1==""){
					alert(arrPara[i]+"不能为空");
	        		return;
				}
			}
			var unitWeight = $("#unitWeight").val();
    		if(unitWeight==null||unitWeight==""){
    			alert("请维护商品单位重量");
        		return;
    		}
    		$.ajax({
 	 		    type:"post",
 	 		    url:"<%=path%>/postTrade/save.do",
 	 		    data:dataStr,
 	 		  	dataType:"json",
 	 		    success:function(data){
 	 		    	console.info(data);
 	 	 		    var flag = data.saveFlag;
 	 	 		    var productId = data.productId;
 	 	 		    if(flag=="1"){
 	 	 	 		    window.location.href="<%=path %>/postTrade/toPostTradeThreePage.do?productId="+productId;
 	 	 	 		}
 	 	 		}
 	 		});
    	}

	    function _onchangeBrandName(val){
	        $.ajax({
	            type:"post",
	            url:"<%=path %>/postTrade/getBrandInfo.do",
	            dataType:"json",
	            data:{brandName:val},
	            success:function(data){
	                if(data){
		                console.log(data);
		                var html = "";
	                    for(var i=0;i<data.length;i++){
	                        html += "<option value="+data[i].BRAND_CODE+" class='selectO' onclick=\"_clickOption('brand','"+data[i].BRAND_NAME+"')\">&nbsp;"+data[i].BRAND_NAME+"</option>";
	                    }
	                    $("#selbrand").empty();
	                    $("#selbrand").append(html);
	                }
	            }
	        });
	    }

	    function _checkBrand(val){
		    if(val == null || val == '') return;
		    $.ajax({
	            type:"post",
	            url:"<%=path %>/postTrade/getBrandInfo.do",
	            dataType:"json",
	            data:{brandName:val},
	            success:function(data){
	                if(data){
		                console.log(data);
		                var html = "";
	                    for(var i=0;i<data.length;i++){
		                    if(val == data[i].BRAND_NAME){
		                    	$("#brandTip").css("display","none");
		                    	$("#selbrand").val(data[i].BRAND_CODE);
		                    }else{
			                    alert("品牌不存在，请输入正确的品牌名称");
			                    $("#brandTip").css("display","");
			                    $("#selbrand").val("");
		                    }
	                    }
	                }
	            }
	        });
	    }

  	</script>
	
	<script type="text/javascript">

	var zTree = null;
	
	$(function(){
		zTree = $.fn.zTree.init($("#treeDemo"), treeSetting);
	});
	/* 
	 * 下拉树的设置 
	 */  
	var treeSetting = {  
	    view: {  
	        dblClickExpand: false  
	    },  
		data: {  
			simpleData: {  
			    enable: true,
			    rootPId: 0
			}  
		},
		check: {  
			enable: true,
			autoCheckTrigger:true
		}, 
		async:{
			enable: true,//设置ztree是否开启异步加载模式
			showLine: true ,//设置是否显示连接线
			type: "post",//post方式请求数据
			url: getUrl,//数据请求url
			autoParam:["id","name"],//异步加载时需要自动提交父节点属性的参数
			otherParam:{"otherParam":"zTreeAsyncTest"},
			dataFilter: filter
		},
		callback: {
			beforeClick: beforeClick,
			onCheck: onCheck,
			onAsyncError : zTreeOnAsyncError,//加载失败
			onAsyncSuccess: zTreeOnAsyncSuccess//加载完成
		}
	}; 

	function getUrl(treeId, treeNode){
		var url = "<%=path %>/postTrade/getTree.do";
		return url;
	}
	
	function beforeClick(treeId, treeNode) {
		var zTree = $.fn.zTree.getZTreeObj("treeDemo");
		zTree.checkNode(treeNode, !treeNode.checked, null, true);
		return false;
	}
	
	/* 
	 * 点击事件 
	 */  
	function onCheck(e, treeId, treeNode) {  
		var areaObj = $("#productArea");
		var areaCodeObj = $("#areaCode");
	    var zTree = $.fn.zTree.getZTreeObj("treeDemo");
		var nodes = zTree.getCheckedNodes(true);
		var changeNodes = zTree.getChangeCheckedNodes();
		var v = '';
		var ids = '';
		for (var i=0, l=nodes.length; i<l; i++) {
			if(!nodes[i].isParent){
				v += nodes[i].aname + ",";
				ids += nodes[i].id + ",";
			}
		}
		if (v.length > 0 ) v = v.substring(0, v.length-1);
		if (ids.length > 0 ) ids = ids.substring(0, ids.length-1);
		areaObj.attr("value", v);
		areaCodeObj.attr("value", ids);
	}
	function _showShopArea() {
		var areaObj = $("#productArea");
		var areaOffset = $("#productArea").offset();
		
		$("#menuContent").css({left:areaOffset.left + "px", top:areaOffset.top + areaObj.outerHeight() + "px"}).slideDown("fast");
		$("body").bind("mousedown", onBodyDown);
	}

	function hideMenu() {
		$("#menuContent").fadeOut("fast");
		$("body").unbind("mousedown", onBodyDown);
	}
	
	function onBodyDown(event) {
		if (!(event.target.id == "menuBtn" || event.target.id == "menuContent" || $(event.target).parents("#menuContent").length>0)) {
			hideMenu();
		}
	}
	//过滤函数  
    function filter(treeId, parentNode, childNodes) {  
        if (!childNodes)  
            return null;  
        for ( var i = 0, l = childNodes.length; i < l; i++) {  
            //childNodes[i].name = childNodes[i].name.replace(/\.n/g, '.');  
        }  
        return childNodes;  
    }  
    //加载完成
	var firstAsyncSuccessFlag = 0;
	function zTreeOnAsyncSuccess(event, treeId, msg) {
		if (firstAsyncSuccessFlag == 0) {
        	try {
				//调用默认展开第一个结点
			//	var nodes = zTree.getNodes();
			//	zTree.expandNode(nodes[0], true);
			//	for(var i = 0; i< nodes.length; i++){
			//		zTree.expandNode(nodes[i], true);
			//	}
			//	$("#treeDemo").click();
	            
	            //异步加载完成再折叠所有子节点
	            var nodes = zTree.getNodes();
				if (nodes.length>0) {
					var index = zTree.getNodeIndex(nodes[0]);
					for(var j=0; j<nodes.length; j++){
						var rootNode = nodes[j];
						zTree.expandNode(rootNode, false, true, null, true);
					}
				}
	            
	            firstAsyncSuccessFlag = 1;
        	} catch (err) {
	              
         	}
    	}
	}
	//加载失败提示  
    function zTreeOnAsyncError(event, treeId, treeNode, XMLHttpRequest, textStatus, errorThrown) {  
        alert("加载错误：" + XMLHttpRequest);  
    }

	</script>
  </head>
  
  <body>
  	<div id="contentDiv">
  		<div style="background: #ebebeb;">
  		<input type="hidden" id="itemCode" name="itemCode" value="${itemCode }">
  		<input type="hidden" id="codeName" name="codeName">
  		<input type="hidden" id="colNames" name="colNames">
  		<input type="hidden" id="paraNames" name="paraNames">
  		<input type="hidden" id="paramShows" name="paramShows">
  		<input type="hidden" id="shopId" name="shopId">
  		<input type="hidden" id="imgNum" name="imgNum" value="0">
	   	<div class="title_div">
	   		<div class="titleCss title_2"></div>
	   	<hr color="#ebebeb" height="0.1px" style="margin-top:13px;display: none;"/>
	   	</div>
	   		<div class="main_div1">
	   			<p style="float:left;white-space: nowrap;">
	   				<strong>您选择的类目：</strong>${itemName }
	   				<a style="margin-left:10px" href="#" onclick="_goBackPage()">修改</a>
	   			</p>
	   			<a href="#" class="btCss" style="display: none;">纠错/建议</a>
	   			<ul style="float:right;display: none;">
	   				<li style="width: 190px;line-height: 48px;">
	   					<a href="#" onclick="_getDraftListPage()" class="getDraftCss">查看草稿箱</a>
	   					<a class="saveDraftCss" href="#" onclick="_saveDraftInfo()">保存草稿</a>
	   				</li>
	   			</ul>
	   		</div>
	   		<div style="background:#fff;font-size: 12px;">
	   			<div class="divCss_title">商品基本信息</div>
	   			<div class="div_title_css" style="display: none;">
	   				<h4 class="tipH4">商品参数：</h4><span style="color:#999;">填错商品属性将可能导致商品下架或搜索不到，请准确填写商品属性！</span>
	   			</div>
	   			<div style="line-height:18px;">
	   				<table id="cdyPara" class="cdyParaCss" style="width: 100%;line-height: 35px;margin-top: 5px;">
	   					<tr>
	   						<td class="tdL"><h4 style="font-weight: bold;">商品参数：</h4></td>
	   						<td class="tdR">
	   						<span style="color:#999;">填错商品属性将可能导致商品下架或搜索不到，请准确填写商品属性！</span>
	   						</td>
	   					</tr>
	   					<tr>
	   						<td class="tdL">商品名称：</td>
	   						<td class="tdR">
	   							<div><input id='postName' name='postName' placeholder='请输入商品名称'/></div>
	   						</td>
	   					</tr>
	   					<tr>
	   						<td class="tdL">品牌名称：</td>
	   						<td class="tdR">
	   							<div class="brand" style="float: left;border: 1px solid #c7c7c7;height: 22px;width: 280px">
			   						<input onchange='_checkBrand(this.value)' oninput="_onchangeBrandName(this.value)"  placeholder='请输入品牌名称' onclick="_clickInput('brand')" style="height:19px;border: 0px;padding-left:5px;margin-top: -15px;" id="brand" name="brand" value=""/>
			   						<s onclick="_clickInput('brand')" class="selectS"> </s>
			   						<br/>
			   						<select id="selbrand" class="brand" size="2" style="overflow-y:auto;height:100px;margin: -12px 0px 0px -1px; position: absolute; width: 284px; border: 1px solid rgb(134, 180, 248);display: none;">
			   							<!--<c:forEach items="${brandList}" var="info">
				   							<option value="${info.BRAND_CODE }" class='selectO' onclick="_clickOption('brand','${info.BRAND_NAME }')">&nbsp;${info.BRAND_NAME }</option>
			   							</c:forEach>-->
			   						</select>
		   						</div>
		   						<div id="brandTip" style="color: red;float: left;border: 0px;line-height: 20px;white-space: nowrap;display: none;">&nbsp;品牌不存在，请输入正确的品牌名称</div>
	   						</td>
	   					</tr>
	   				</table>
	   				<table class="cdyParaCss" style="width: 100%;line-height: 35px;margin-top: 5px;">
	   					<tr>
		   					<td style="">
		   						<s onclick="_addPara()" class="addPrice_css" style="margin-top: -1px;margin-right: -5px;float: right;"> </s>
	   						</td>
							<td onclick="_addPara()" style="width: 5%">
	   							<span style="color: #039;white-space: nowrap;">添加自定义参数</span>
							</td>
							<td style="color: #999;width:75%">(如不能满足您的需求，可添加自定义参数)</td>
	   					</tr>
   					</table>
   					<table id="cdyArea" class="cdyAreaCss" style="width: 100%;line-height: 35px;margin-top: 5px;">
	   					<tr style="">
	   						<td class="tdL" style="vertical-align: top;text-align: right;width: 152px;">买家范围：</td>
	   						<td class="tdR" style="width: 295px;text-align: left;padding-left: 10px;vertical-align: middle;" colspan="2">
	   							<div class="buyerRange" style="float: left;border: 1px solid #c7c7c7;height: 22px;width: 282px">
			   						<input onclick="_clickInput('buyerRange')" style="height:19px;border: 0px;padding-left:5px;margin-top: -15px;width: 90%" id="buyerRange" name="buyerRange" value="全部"/>
			   						<s onclick="_clickInput('buyerRange')" class="selectS"> </s>
			   						<br/>
			   						<select id="selbuyerRange" class="buyerRange" size="2" style="overflow-y:auto;height:40px;margin: -12px 0 0 -1px; position: absolute; width: 284px; border: 1px solid rgb(134, 180, 248);display: none;">
			   							<option value="1" class='selectO' onclick="_clickOption('buyerRange','全部')">&nbsp;全部</option>
			   							<option value="2" class='selectO' onclick="_clickOption('buyerRange','自定义')">&nbsp;自定义</option>
			   						</select>
		   						</div>
	   						</td>
	   					</tr>
	   					<tr style="height: 100px">
	   						<td class="tdL" style="vertical-align: top;text-align: right;width: 152px;">商品销售区域：</td>
	   						<td class="tdR" style="width: 295px;text-align: left;padding-left: 10px;vertical-align: middle;">
	   							<input type="hidden" id="areaCode" name="areaCode" value="${areaCode }"/>
   								<textarea id="productArea" name="productArea" style="width: 400px; height: 100px; resize: none;" 
   									readonly="readonly" onclick="_showShopArea();">${areaName}</textarea>
   								<div id="menuContent" class="menuContent" style="display:none; position: absolute;border: 0px;">
									<ul id="treeDemo" class="ztree" style="margin-top:0; width:396px;height:230px;display: ">
									</ul>
								</div>
	   						</td>
	   						<td style="">
	   							<button style="margin-left: 10px;height: 30px;width: 70px;background: #f3ed07;border-radius:5px;margin-top: 65px;"
	   							onclick="_showShopArea();return false;">区域选择</button>
	   						</td>
	   					</tr>
	   				</table>
	   			</div>
	   			<div class="borderCss"></div>
	   			<div  class="div_title_css">
	   				<h4 class="tipH4" style="padding-top: 4px;"><span style="color: #f00;">*</span>商品关键词：</h4>
	   				<table style="text-align: center;width: 80%">
	   					<tr>
	   						<td><input id="keyWord1" name="keyWord1" onkeyup="_keyWordLength()"/></td>
	   						<td><input id="keyWord2" name="keyWord2" onkeyup="_keyWordLength()"/></td>
	   						<td><input id="keyWord3" name="keyWord3" onkeyup="_keyWordLength()"/></td>
	   						<td><input id="keyWord4" name="keyWord4" onkeyup="_keyWordLength()"/></td>
	   						<td><input id="keyWord5" name="keyWord5" onkeyup="_keyWordLength()"/></td>
	   						<td>
		   						<span id="keyWordSpan" style="color: #f00;display:none">请输入商品关键词</span>
	   						</td>
	   					</tr>
	   				</table>
	   				<p>商品关键词用于商品匹配，并影响到搜索排名。关键词建议填写商品专业名称、别称、习惯叫法等，切勿填写与商品无关的词汇。
						<br>多可填写5个关键词，每个文本框一个关键词，每个关键词不可超过20个字符，无需添加标点符号。</p>
	   			</div>
	   			<div class="borderCss" style="display: none;"></div>
	   			<div  class="div_title_css" style="display: none;">
	   				<h4 class="tipH4" style="padding-top:4px;"><span style="color: #f00;">*</span>信息标题：</h4>
	   				<input style="width:400px;height:22px;padding-left:3px;" onkeyup="_change(this.value)"/><span id="pId" style="color:#999;padding-left: 10px;">0/60字</span>
	   				<p style="padding-left:80px;">勿使用联系人、联系方式、疑问词句，特殊字符及堆砌关键词。建议包含：品牌+型号+商品关键词</p>
	   			</div>
	   		</div>
	   		<div style="background:#fff;font-size: 12px;padding-bottom: 15px;">
	   			<div class="divCss_title">商品交易信息</div>
	   			<div style="padding:20px 0px 0px 23px;">
	   				<table style="width: 100%;line-height: 40px;">
	   					<tr style="display: none;">
	   						<td class="td1">是否支持网上交易：</td>
	   						<td>
		   						<lable><input type="radio" name="onlineTrading" class="radioCss"/> 支持</lable>
		   						<lable style="padding-left:20px;"><input type="radio" name="onlineTrading" class="radioCss"/> 不支持</lable>
		   						<span style="white-space: nowrap;padding-left:30px;"> 发布支持网上交易商品，您需要提交经营资质备案。<a href="#">立即备案</a>&nbsp;&nbsp;<a href="#">备案教程</a></span>
		   					</td>
	   					</tr>
	   					<tr>
	   						<td class="td1">计量单位：</td>
	   						<td style="vertical-align: middle;">
	   							<div class="measuring" style="float: left;border: 1px solid #c7c7c7;height: 22px;">
			   						<input onclick="_clickInput('measuring')" style="height:19px;border: 0px;padding-left:3px;margin-top: -21px;" id="measuring" name="measuring" placeholder="请选择计量单位"/>
			   						<s onclick="_clickInput('measuring')" class="selectS"> </s>
		   						</div>
	   						</td>
	   					</tr>
	   					<tr style="display: none;">
	   						<td class="td1">报价方式：</td>
	   						<td>
	   							<lable><input type="radio" name="priceWay" class="radioCss"/> 电话报价</lable>
		   						<lable style="padding-left:20px;"><input type="radio" name="priceWay" class="radioCss"/> 直接报价</lable>
	   						</td>
	   					</tr>
	   					<tr>
	   						<td class="td1" style="vertical-align: top;">价格区间：</td>
	   						<td>
	   							<table class="line_color_css" style="width: 50%;line-height: 34px;border: 1px solid #c7c7c7;border-top: 0px;float: left; margin-right: 5%;">
		   							<tr style="text-align: center;">
		   								<td style="width:55%"><em style="color:#f00;">*</em>&nbsp;采购数量</td>
		   								<td style="text-align: left;"><em style="color:#f00;">*</em>&nbsp;商品单价</td>
		   							</tr>
		   							<tr>
		   								<td>&nbsp;起批量<input id="buyNum0" name="buyNum0" style="width: 70px;height: 22px;" onblur="_previewHtml('0','-1')"/>以上：</td>
		   								<td><input id="price0" name="price0" style="width: 70px;height: 22px;" onblur="_previewHtml('0','-1')"/> 元/<span class="unitVal">个</span></td>
		   							</tr>
		   							<tr id="p0" class="tr1" style="display: none;border: 0px;text-align: center;">
		   								<td style="border: 0px;color: #f00">
		   									<em id="p01" class="tr1" style="display: none;">采购数量必须大于前者</em>
		   									<em id="t01" style="display: none;">请输入采购数量</em>
		   								</td>
		   								<td style="border: 0px;color: #f00;text-align: left;">
		   									<em id="p02" class="tr1" style="display: none;">商品单价必需小于前者</em>
		   									<em id="t02" class="tr1" style="display: none;">请输入商品单价</em>
		   								</td>
		   							</tr>
		   							<tr id="tr1" style="display: none;">
		   								<td>&nbsp;购&nbsp;买<input id="buyNum1" name="buyNum1" style="width: 70px;height: 22px;"  onblur="_onbl('buyNum1','1','buyNum0')"/>以上：</td>
		   								<td><input id="price1" name="price1" style="width: 70px;height: 22px;" onblur="_onbl('price1','2','price0')"/> 元/<span class="unitVal"></span> <em style="color: #f00" onclick="_delTr('tr1')">删除</em></td>
		   							</tr>
		   							<tr id="p1" class="tr1" style="display: none;border: 0px;text-align: center;">
		   								<td style="border: 0px;color: #f00">
		   									<em id="p11" class="tr1" style="display: none;">采购数量必须大于前者</em>
		   									<em id="t11" style="display: none;">请输入采购数量</em>
		   								</td>
		   								<td style="border: 0px;color: #f00;text-align: left;">
		   									<em id="p12" class="tr1" style="display: none;">商品单价必需小于前者</em>
		   									<em id="t12" class="tr1" style="display: none;">请输入商品单价</em>
		   								</td>
		   							</tr>
		   							<tr id="tr2" style="display: none;">
		   								<td>&nbsp;购&nbsp;买<input id="buyNum2" name="buyNum2" style="width: 70px;height: 22px;" onblur="_onbl('buyNum2','1','buyNum1')"/>以上：
		   								</td>
		   								<td><input id="price2" name="price2" style="width: 70px;height: 22px;" onblur="_onbl('price2','2','price1')"/> 元/<span class="unitVal"></span> <em style="color: #f00" onclick="_delTr('tr2')">删除</em></td>
		   							</tr>
		   							<tr id="p2" class="tr2" style="display: none;border: 0px;text-align: center;">
		   								<td style="border: 0px;color: #f00">
		   									<em id="p21" class="tr2" style="display: none;">采购数量必须大于前者</em>
		   									<em id="t21" class="tr2" style="display: none;">请输入采购数量</em>
		   								</td>
		   								<td style="border: 0px;color: #f00;text-align: left;">
		   									<em id="p22" class="tr2" style="display: none;">商品单价必需小于前者</em>
		   									<em id="t22" class="tr2" style="display: none;">请输入商品单价</em>
		   								</td>
		   							</tr>
		   							<tr id="addPrice">
				   						<td colspan="2">
				   							<s class="addPrice_css"> </s>
				   							<em style="color: #039" onclick="_addPrice()">增加价格区间</em>
				   						</td>
				   					</tr>
		   						</table>
		   						<table style="width: 40%;border: 1px solid #c7c7c7;">
		   							<tr>
		   								<td style="width: 50px;background: #ebebeb;text-align: center;height: 105px;vertical-align: middle;"><span style="">预<br/>览</span></td>
		   								<td style="text-align: center;vertical-align: middle;">
		   									<table id="preview" style="width: 100%;height: 105px;padding: 0 8px;color: #999">
		   										<tr id="yl"><td colspan="2"><span style="color: #999">可根据买家采购数量的不同设置不同价格</span></td></tr>
		   										<tr id="preview0" style="display: none;">
		   											<td style="width: 40%;text-align: left;"><span id="preview01" ></span></td>
		   											<td><span id="preview02" ></span><span class="unitVal"></span></td>
		   										</tr>
		   										<tr id="preview1" style="display: none;">
		   											<td style="border-top: 1px dotted #c7c7c7;text-align: left;">
		   												<span id="preview11" ></span>
		   											</td>
		   											<td style="border-top: 1px dotted #c7c7c7">
		   												<span id="preview12" ></span><span class="unitVal"></span>
		   											</td>
		   											</tr>
		   										<tr id="preview2" style="display: none;">
		   											<td style="border-top: 1px dotted #c7c7c7;text-align: left;">
		   												<span id="preview21" ></span>
		   											</td>
		   											<td style="border-top: 1px dotted #c7c7c7">
		   												<span id="preview22" ></span><span class="unitVal"></span>
		   											</td>
		   											</tr>
		   									</table>
		   								</td>
		   							</tr>
		   						</table>
	   						</td>
	   					</tr>
	   					<tr>
	   						<td class="td1">供应总量：</td>
	   						<td>
	   							<input id="proStock" name="proStock" onBlur="_checkNum('2',this)" style="border: 1px solid #c7c7c7;height: 22px;width: 188px;"/>&nbsp;<span class="unitVal"></span>
	   							成本价格：<input id="proPrice" name="proPrice" onBlur="_checkNum('1',this)" style="border: 1px solid #c7c7c7;height: 22px;width: 188px;"/>&nbsp;元&nbsp;
	   						</td>
	   					</tr>
	   					<tr>
	   						<td class="td1">是否允许退换货：</td>
	   						<td>
		   						<div class="allowReturn" style="float: left;border: 1px solid #c7c7c7;height: 22px;">
			   						<input onclick="_clickInput('allowReturn')" style="height:19px;border: 0px;padding-left:5px;margin-top: -20px;" id="allowReturn" name="allowReturn" value="否"/>
			   						<s onclick="_clickInput('allowReturn')" class="selectS"> </s>
			   						<br/>
			   						<select id="selallowReturn" class="allowReturn" size="2" style="overflow-y:auto;height:40px;margin: -18px 0 0 -1px; position: absolute; width: 170px; border: 1px solid rgb(134, 180, 248);display: none;">
			   							<option value="0" class='selectO' onclick="_clickOption('allowReturn','否')">&nbsp;否</option>
			   							<option value="1" class='selectO' onclick="_clickOption('allowReturn','是')">&nbsp;是</option>
			   						</select>
		   						</div>
	   						</td>
	   					</tr>
	   				</table>
	   			</div>
	   		</div>
	   		
	   		<div style="margin: 10px 0px;background:#fff;font-size: 12px;padding-bottom: 15px;">
	   			<div class="divCss_title">图片和详细说明</div>
	   			<div class="div_title_css">
	   				<h4 class="tipH4"><span style="color: #f00;">*</span>商品图片：</h4>
	   				<p style="padding-top: 0px;">您可以上传8张图片，大小不可超过2MB，第1张将做为商品主图。</p>
					<p style="padding-top: 0px;">建议上传至少3张以上，不小于500*500像素的真实图片，支持jpg,jpeg,gif,bmp格式。</p>
					<div style="margin-left: 83px;">
					<div style="width: 95%;border:1px solid #c7c7c7; height: 250px;">
						<div id="imgDiv" style="padding-left: 30px;padding-top: 10px;">
							<div id="file1" style="float: left;padding-top: 50px;">
								<input id="fileupload2" type="file" name="fileupload" multiple class="input-medium"/>
							</div>
						</div>
					</div>
					</div>
					<br/>
					<h4 class="tipH4"><span style="color: #f00;">*</span>商品描述：</h4>
					<div style="margin-left: 83px;width: 95%; float: none;">
						<div style="border: 1px solid #c7c7c7;width: 120px;height:23px;color: #039;line-height: 23px;text-align: center;float: left;" onclick="_addInfo()">自动生成简介</div>
						<span style="color: #999;">&nbsp;&nbsp;建议以图文结合的方式，至少插入3张以上宽度不小于700像素的细节图进行描述。不要包含联系方式</span>
					</div>
	   			</div>
		   		<div style="margin: 20px 0px 10px 163px;white-space: normal;">
		   			<input type="hidden" id="postDesc" name="postDesc"/>
		   			<div style="width:95%;">
			   			<script id="editor" type="text/plain" style="width:100%;height:350px;"></script>
		   			</div>
		   		</div>
	   		</div>
	   		
	   		<div style="margin: 0px 0px;background:#fff;font-size: 12px;padding-bottom: 15px;">
	   			<div class="divCss_title">物流运费信息</div>
	   			<div style="padding:20px 0px 0px 23px;">
	   				<table style="width: 100%;line-height: 40px;">
	   					<tr>
	   						<td class="td1">单位重量：</td>
	   						<td>
	   							<input id="unitWeight" name="unitWeight" style="border: 1px solid #c7c7c7;height: 22px;width: 188px;"/>&nbsp;公斤/<span class="unitVal"></span>&nbsp;&nbsp;<span style="color: #999">请选择计量单位</span>
	   						</td>
	   					</tr>
	   					<tr>
	   						<td class="td1">发货日期：</td>
	   						<td style="vertical-align: middle;">
	   							<div class="sendDate" style="float: left;border: 1px solid #c7c7c7;height: 22px;">
			   						<input onclick="_clickInput('sendDate')" style="height:19px;border: 0px;padding-left:5px;margin-top: -20px;" id="sendDate" name="sendDate" value="10天内"/>
			   						<s onclick="_clickInput('sendDate')" class="selectS"> </s>
			   						<br/>
			   						<select id="selsendDate" class="sendDate" size="19" style="overflow-y:auto;height:100px;margin: -18px 0 0 -1px; position: absolute; width: 170px; border: 1px solid rgb(134, 180, 248);display: none;">
			   							<option value="0" class='selectO' onclick="_clickOption('sendDate','面议')">&nbsp;面议</option>
			   							<c:forEach begin="1" end="15" step="1" var="num">
			   								<option value="${num }" class='selectO' onclick="_clickOption('sendDate','${num }天')">&nbsp;${num }天</option>
			   							</c:forEach>
			   							<option value="20" class='selectO' onclick="_clickOption('sendDate','20天')">&nbsp;20天</option>
			   							<option value="30" class='selectO' onclick="_clickOption('sendDate','30天')">&nbsp;30天</option>
			   							<option value="60" class='selectO' onclick="_clickOption('sendDate','60天')">&nbsp;60天</option>
			   						</select>
		   						</div>
	   						</td>
	   					</tr>
	   				</table>
	   			</div>
	   		</div>
	   		<div style="margin-top: 10px;background:#fff;font-size: 12px;padding-bottom: 15px;">
	   			<div class="divCss_title">其他信息</div>
	   			<div style="padding:20px 0px 0px 23px;">
	   				<table style="width: 100%;line-height: 40px;">
	   					<tr>
	   						<td class="td1">发布到炫铺：</td>
	   						<td>
	   							<input type="hidden" id="shopTypeCode" name="shopTypeCode"/>
	   							<select id="type1" name="type1" class="selType" style="width: 130px;" onchange="_getShopyType('2',this.value),_changeShopType(this.value)">
	   								<option value="">请选择一级分类</option>
	   							</select>
	   							<select id="type2" name="type2" class="selType" style="width: 130px;margin-left: 20px;" onchange="_changeShopType(this.value)">
	   								<option value="">请选择二级分类</option>
	   							</select>
	   						</td>
	   					</tr>
	   				</table>
	   			</div>
	   		</div>
		   	<div class="mainDiv">
				<div class="subDiv">
					<div class="nextDiv">
						<button onclick="_save()">发布供应信息</button>
					</div>
				</div>
		   	</div>
		 </div>
  	</div>
  </body>
  	<script type="text/javascript">
  		function _keyWordLength(){//是否填写关键字验证
  	  		var len = 0;
  	  		for(var i=1;i<=5;i++){
  	  	  		len += $("#keyWord"+i).val().length;
  	  		}
  	  		if(len<=0) $("#keyWordSpan").css("display","");
  	  		else $("#keyWordSpan").css("display","none");
  		}
  		function _checkNum(flag,obj){
  			var result = _checkNumF(flag,obj.value);
  			if(!result){
  				if(flag=="1"){
	  				parent.swal('请输入数值！'); 
	  				obj.value=0;
  				} else if(flag=="2"){
	  				parent.swal('请输入正整数！'); 
	  				obj.value=0;
  				}
  			}
  		}
		function _change(value){//信息标题长度
			_keyWordLength();
			$("#pId").empty();
			$("#pId").html(value.length+"/60字");
		}
		var num = 1
		function _addPrice(){
			var tr1 = $("#tr1").css("display");
			if("none"==tr1) $("#tr1").css("display","");
			else{
				 $("#price2").val("");
				 $("#buyNum2").val("");
				 $("#tr2").css("display","");
				 $("#addPrice").css("display","none");
			}
		}
		function _delTr(id){
			var tr1 = $("#tr1").css("display");
			var tr2 = $("#tr2").css("display");
			if(id=="tr1"){
				if(tr2=="none"){ 
					$("#tr1").css("display","none");
					$("#price1").val("");
					$("#buyNum1").val("");
				}else{
					 $("#tr2").css("display","none");
					 $("#price1").val($("#price2").val());
					 $("#buyNum1").val($("#buyNum2").val());
				}
			}else{
				$("#tr2").css("display","none");
			}
			$("#addPrice").css("display","");
			$("."+id).css("display","none");
			id = id.charAt(id.length-1);
			if(id=="1"){
				var dis = $("#preview2").css("display");
				if(dis != "none")  $("#preview2").css("display","none");
				else $("#preview1").css("display","none");
				_previewHtml("0","0");
			}else{
				_previewHtml(id,"0");
			}
		}
		function _onbl(id1,v2,id3){
			var val1 = parseFloat($("#"+id1).val());
			var val3 = parseFloat($("#"+id3).val());
			var id = "p"+id1.charAt(id1.length-1);
			var bln = val3>=val1;
			if(id1.charAt(0)=="p") bln = val3 <= val1;
			var dis = $("#"+id).css("display");
			if(bln){
				$("#"+id).css("display","");
				$("#"+id+v2).css("display","");
			}else{
				if(dis=="none") $("#"+id).css("display","none");
				$("#"+id+v2).css("display","none");
			}
			_previewHtml(id1.charAt(id1.length-1),id3.charAt(id1.length-1));
		}
		function _previewHtml(id1,id2){
			var bn = $("#buyNum"+id1).val();
			var price = $("#price"+id1).val();
			var measuring = $("#measuring").val();
			if(price == "" || bn == "") return;
			$("#yl").css("display","none");
			$("#preview"+id1).css("display","");
			var pHtml = price+" 元/"
			$("#preview"+id1+"2").text(pHtml);
			$(".unitVal").empty();
			 $(".unitVal").text(measuring);
			if(id1=="0"){
				$("#preview01").text("≥"+bn);
			}else{
				var bn1 = $("#buyNum"+id2).val();
				$("#preview"+id1+"1").text("≥"+bn);
				if(bn1 != ""){
					var num = parseInt(bn)-1;
					$("#preview"+id2+"1").text(bn1+"~"+num);
				}
				var price1 = $("#price"+id2).val();
				if(price1 != ""){
					pHtml = price1+" 元/"
					$("#preview"+id2+"2").text(pHtml);
				}
			}
		}
		var vPrice = 0;
		function _vfnPrice(){
			for(var i=0;i<3;i++){
				var bn = $("#buyNum"+i).val();
				var price = $("#price"+i).val();
				if(i==0){
					if(bn == "" && price == ""){
						vPrice = 1;
						return;
					}
				}
				if((bn == "" && price != "") || (bn != "" && price == "")){
					vPrice = 1;
					return;
				}
				var dis = $("#p"+i).css("display");
				if(dis != "none") vPrice = 1;
			}
		}
		function _regVal(id1,v2){
			var v = $("#"+id1).val();
			var id = id1.charAt(id1.length-1);
			if(v==""){
				$("#p"+id).css("display","");
				$("#t"+id+v2).css("display","");
				v="1";
			}else{
				$("#p"+id).css("display","none");
				$("#t"+id+v2).css("display","none");
			}
			return v;
		}
		function _initImg(){
			$("#fileupload2").uploadify({
			 	"debug":false,
			 	"swf":"<%=path%>/include/uploadify/uploadify.swf",
			 	"uploader":"<%=path%>/upload/uploadPicHttp",
			 	"cancelImg":"<%=path%>/include/uploadify/cancel.png",
				 "queueID":"fileQueue2",
				 "fileObjName":"fileupload",
				 "formData":{"lll":"lll"},
				 "auto":true,
				 "multi":false,
				 "removeCompleted":true,
				 "progressData":"percentage", 
				 "buttonText":"选择图片",
				 "width":"120",
				 "height":"22",
				 "simUploadLimit":3,
				 "fileSizeLimit":"2MB",
				 "queueSizeLimit":5,
				 "fileTypeDesc":"支持格式:jpg/gif/jpeg/png/bmp.",
				 "fileTypeExts":"*.jpg;*.gif;*.jpeg;*.png;*.bmp;",
				 "onUploadStart":function(b){
				 	
				 },
				 "onUploadSuccess":function(b,c,a){
						if(c=="error"){
							alert("文件:"+b.name+"上传失败");
							return false;
						}
						var index = getNewIndex();
						if (index == -1) {
							alert("最多只能上传8个图片");
						} else {
							var html = "<div id='imgDiv"+index+"' class='img_css'>";
								html += "<input type='hidden' id='pic"+index+"' name='pic"+index+"' value='"+c+"' />";
								html += "	<img src='"+c+"'";
								html += "		id='imgView"+index+"' style='height: 75px; width: 100px;'>";
								html += "	<a href='javascript:delPic("+index+")'>删除</a>";
								html += "</div>";
							//$("#proPic" + index).val(c);
							//$("#imgDiv" + index).show();
							//$("#imgView" + index).attr("src", c);
							//$("#imgDiv").append(html);
							$("#file1").before(html);
						}
				 },
				 onError:function(c,a,b){alert("文件:"+b.name+"上传失败");},
				 onCancel:function(c,a,b){}
			});
		}
		var imgNum = 1;
		function getNewIndex(){
			$("#imgNum").val($("#imgNum").val()+","+imgNum);
			var objs = $("input[id^=pic]");
			if(objs.length==7) $("#file1").css("display","none");
			if(objs.length<8)return imgNum++; 
			else return -1;
		}
		function delPic(number) {
			$("#imgNum").val($("#imgNum").val().replace(","+number,""));
			$("#imgDiv" + number).remove();
			$("#file1").css("display","");
		}

		function _getShopyType(level,pcode){
			$(".shopType").remove();
			$.ajax({
				type:"post",
				url:"<%=path%>/postTrade/getShopType.do",
				dataType:"json",
				data:{level:level,typePCode:pcode},
				success:function(data){
					if(data){
						var list = data.shopTypeList;
						var html = "";
						if(list.length>0) $("#shopId").val(list[0].shopId);
						if(level=="1"){
							for(var i=0;i<list.length;i++){
								html += "<option value='"+list[i].typeCode+"'>"+list[i].typeName+"</option>";
							}
						}else{
							for(var i=0;i<list.length;i++){
								html += "<option class='shopType' value='"+list[i].typeCode+"'>"+list[i].typeName+"</option>";
							}
						}
						$("#type"+level).append(html);
						
						_reHeight("rightFrame","contentDiv");
					}
				}
			});
		}
		function _changeShopType(val){
			$("#shopTypeCode").val(val);
		}

		var ue = UE.getEditor('editor');
    	function _addInfo(){
    		 ue.setContent('<%=proDesc%>');
    	} 
    	
    	function _checkKeyWord(){
    		var keyWord1 = $("#keyWord1").val();
    		var keyWord2 = $("#keyWord2").val();
    		var keyWord3 = $("#keyWord3").val();
    		var keyWord4 = $("#keyWord4").val();
    		var keyWord5 = $("#keyWord5").val();
    		if(keyWord1=="" && keyWord2=="" && keyWord3=="" && keyWord4 =="" && keyWord5==""){
    		  return true;
    		} else {
    		  return false;
    		}
    	}
    	$(function(){
			_reHeight("rightFrame","contentDiv");
			_baseParam("${itemCode}");
			_measuringInfo();
			_initImg();//init upload image
			_getShopyType("1","");//店铺类别
			_onchangeBrandName("");
		});
	</script>
	
</html>
